Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

Add expectation value measurement error mitigation #500

Merged
merged 39 commits into from
Sep 23, 2020

Conversation

chriseclectic
Copy link
Collaborator

@chriseclectic chriseclectic commented Sep 18, 2020

Summary

This replaces #457 by adding expectation value measurement error mitigation using the current Ignis API style.

Co-authored-by: George S. Barron [email protected]

Details and comments

It includes Full A-matrix, tensored A-matrix, and CTMP mitigation methods.

For the CTMP method Numba will be used if it is installed to greatly improve performance.

TODO:

  • Release Note
  • Add Numba to setup.py extras
  • Remove example notebook

chriseclectic and others added 28 commits September 18, 2020 16:13
…tigation

* Allow non-Z diagonal expval operators.
* Add function for returning mitigation overhead
* Add function for returning std-dev upper bound of estimation
* Add function for returning required shots for mitigation accuracy
Base class functions that compute properties from A-matrix still need to be overloaded to be computed more efficiently using the rate and generator matrices.
Due to Numba not really working well with Numpy random I had to pregenerate a large array of random samples outside of the compiled Numba functions in advance.
Copy link
Collaborator

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add numba as an extra requirement here: https://github.com/Qiskit/qiskit-ignis/blob/master/setup.py#L79-L82 just add a new dict entry where the key is the name and the value is a list of the requirements. So in this case something like 'expval-measurement': ['numba'] it's also probably worth updating the readme section here: https://github.com/Qiskit/qiskit-ignis/blob/master/README.md#extra-requirements after you add it.

@yaelbh
Copy link
Contributor

yaelbh commented Sep 21, 2020

I'm trying to understand the functionality by reading the example notebook. Could you please update the notebook to work with this code?

Copy link
Contributor

@yaelbh yaelbh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still reviewing. I'm submitting, just to let you see the comments that I've made so far. As noted in the conversation, please prepare a usage example (in a notebook, or any other way that sheds a light on the process).

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
qiskit/ignis/mitigation/expval/base_meas_mitigator.py Outdated Show resolved Hide resolved
qiskit/ignis/mitigation/expval/mitigation_example.ipynb Outdated Show resolved Hide resolved
qiskit/ignis/mitigation/expval/circuits.py Outdated Show resolved Hide resolved
qiskit/ignis/mitigation/expval/circuits.py Outdated Show resolved Hide resolved
qiskit/ignis/mitigation/expval/circuits.py Outdated Show resolved Hide resolved
@yaelbh
Copy link
Contributor

yaelbh commented Sep 21, 2020

I'll try to use the tests as usage examples

@yaelbh
Copy link
Contributor

yaelbh commented Sep 21, 2020

I see now the functions in utils.py, these are the functions that I see in the notebook. So the notebook is probably up-to-date.

Copy link
Contributor

@yaelbh yaelbh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I finished to review

qiskit/ignis/mitigation/expval/circuits.py Outdated Show resolved Hide resolved
self._noise_strengths[qubits] = gamma
return self._noise_strengths[qubits]

def seed(self, value=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure that this is the correct location for this function

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how seeds are changed on persistent objects in the quantum info module, but i added an option to set fixed seed at init as well.

@yaelbh
Copy link
Contributor

yaelbh commented Sep 21, 2020

As far as I see, there are no usage examples (tests or notebook) for the diagonal other than the default. This is not tested. See also the comment about the diagonal being a numpy array instead of an operator.

@chriseclectic chriseclectic added the Changelog: New Feature Include in the Added section of the changelog label Sep 22, 2020
yaelbh
yaelbh previously approved these changes Sep 23, 2020
Copy link
Contributor

@yaelbh yaelbh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the comments.

@chriseclectic chriseclectic merged commit 2d940c3 into qiskit-community:master Sep 23, 2020
mtreinish added a commit to mtreinish/qiskit-ignis that referenced this pull request Nov 4, 2020
In qiskit-community#500 type hints were added for the plotting functions using the
optional matplotlib dependencies. This breaks ignis installations
without matplotlib present since it's an optional dependency. Since type
hints are really just for documentation and not necessary this commit
just removes those problematic hints and uses the docstring to document
the types.

At the same time the testing job verifying ignis works without any
optional dependencies that was lost in the migration from travis to
github actions is restored to verify that everything works moving
forward.
mtreinish added a commit to mtreinish/qiskit-ignis that referenced this pull request Nov 4, 2020
In qiskit-community#500 type hints were added for the plotting functions using the
optional matplotlib dependencies. This breaks ignis installations
without matplotlib present since it's an optional dependency. Since type
hints are really just for documentation and not necessary this commit
just removes those problematic hints and uses the docstring to document
the types.

At the same time the testing job verifying ignis works without any
optional dependencies that was lost in the migration from travis to
github actions is restored to verify that everything works moving
forward.

Fixes qiskit-community#532
mtreinish added a commit to mtreinish/qiskit-ignis that referenced this pull request Nov 4, 2020
In qiskit-community#500 type hints were added for the plotting functions using the
optional matplotlib dependencies. This breaks ignis installations
without matplotlib present since it's an optional dependency. Since type
hints are really just for documentation and not necessary this commit
just removes those problematic hints and uses the docstring to document
the types.

At the same time the testing job verifying ignis works without any
optional dependencies that was lost in the migration from travis to
github actions is restored to verify that everything works moving
forward.

Fixes qiskit-community#532
chriseclectic pushed a commit that referenced this pull request Nov 10, 2020
* Fix ignis without optional requirements installed

In #500 type hints were added for the plotting functions using the
optional matplotlib dependencies. This breaks ignis installations
without matplotlib present since it's an optional dependency. Since type
hints are really just for documentation and not necessary this commit
just removes those problematic hints and uses the docstring to document
the types.

At the same time the testing job verifying ignis works without any
optional dependencies that was lost in the migration from travis to
github actions is restored to verify that everything works moving
forward.
mtreinish added a commit to mtreinish/qiskit-ignis that referenced this pull request Nov 12, 2020
* Fix ignis without optional requirements installed

In qiskit-community#500 type hints were added for the plotting functions using the
optional matplotlib dependencies. This breaks ignis installations
without matplotlib present since it's an optional dependency. Since type
hints are really just for documentation and not necessary this commit
just removes those problematic hints and uses the docstring to document
the types.

At the same time the testing job verifying ignis works without any
optional dependencies that was lost in the migration from travis to
github actions is restored to verify that everything works moving
forward.

(cherry picked from commit d9fe8f9)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Changelog: New Feature Include in the Added section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants